package hashMapProject;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

import java.io.FileNotFoundException;
import java.io.FileReader;

import org.junit.Test;

public class WordIndexTest {

	@Test
	public void poisno() {
		try {
			FileReader fileReader = new FileReader("10kwords.txt");
		    WordIndex idx = new WordIndex(fileReader);
		    
		    String startingWord = "poison";
		    String scrambledWord = "poisno";
		    String result = hashMapProject.WordIndex.lookup(scrambledWord);
		    boolean truth = result.contains(startingWord);
		    assertTrue(true);
		    
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	
	@Test
	public void rde() {
		try {
			FileReader fileReader = new FileReader("10kwords.txt");
		    WordIndex idx = new WordIndex(fileReader);
		    
		    String startingWord = "red";
		    String scrambledWord = "der";
		    String result = hashMapProject.WordIndex.lookup(scrambledWord);
		    boolean truth = result.contains(startingWord);
		    assertTrue(true);
		    
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void failTrouble() {
		try {
			FileReader fileReader = new FileReader("10kwords.txt");
		    WordIndex idx = new WordIndex(fileReader);
		    
		    String startingWord = "trouble";
		    String scrambledWord = "troublee";
		    String result = hashMapProject.WordIndex.lookup(scrambledWord);
		    boolean truth = result.contains(startingWord);
		    assertFalse(true);
		    
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
